from python_baway.common.xcommon import sep, xcheck


def ps(s):
    print(sorted(s))


a = set(range(1, 4 + 1))
b = set(range(3, 6 + 1))
ps(a)
ps(b)
xcheck(a, 'a')
xcheck(b, 'b')

sep()
ps(a.union(b))
ps(a.intersection(b))
ps(a.difference(b))
ps(a.symmetric_difference(b))
xcheck(a, 'a')
xcheck(b, 'b')

sep()
ps(a | b)
ps(a & b)
ps(a - b)
ps(a ^ b)
# ps(a + b)  # TypeError: unsupported operand type(s) for +: 'set' and 'set'
xcheck(a, 'a')
xcheck(b, 'b')

sep('c.update(a)')
c = a.copy()
c.update(b)
xcheck(a, 'a')
xcheck(b, 'b')
xcheck(c, 'c')
